package io.renren.sf.controller;

import java.util.Arrays;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.sf.entity.CbStiffReadingEntity;
import io.renren.sf.service.CbStiffReadingService;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author cyl_txw
 * @email cyl_txw@gmail.com
 * @date 2021-04-26 10:46:38
 */
@RestController
@RequestMapping("sf/cbstiffreading")
public class CbStiffReadingController {
    @Autowired
    private CbStiffReadingService cbStiffReadingService;

    /**
     * 通过tid获取字体信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("sf:cbstiffreading:info")
    public R info(@PathVariable("id") Long id){
		CbStiffReadingEntity cbStiffReading = cbStiffReadingService.getOne(new QueryWrapper<CbStiffReadingEntity>().eq("tid",id).last("limit 1"));

        return R.ok().put("cbStiffReading", cbStiffReading);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    //@RequiresPermissions("sf:cbstiffreading:save")
    public R save(@RequestBody CbStiffReadingEntity cbStiffReading){
		cbStiffReadingService.save(cbStiffReading);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //@RequiresPermissions("sf:cbstiffreading:update")
    public R update(@RequestBody CbStiffReadingEntity cbStiffReading){
		cbStiffReadingService.updateById(cbStiffReading);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //@RequiresPermissions("sf:cbstiffreading:delete")
    public R delete(@RequestBody Long[] ids){
		cbStiffReadingService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
